<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Router</title>
</head>

<body>
    <h1>Router测试</h1>
    <a href="#index">首页</a>
    <a href="#test">test页</a>
    <script src="router.js"></script>
    <script>
        let dom = document.querySelector("h1");
        let router = new Router();
        router.route('index', function (hash, preHash) {
            dom.innerHTML = 'this is ' + hash;
            console.log('preHash is ' + preHash);
        })
        router.route('test', function (hash, preHash) {
            dom.innerHTML = 'this is ' + hash;
            console.log('preHash is ' + preHash);
        })
        router.setIndex('index');
    </script>
</body>

</html>